package com.nulgame.bukkit.plugin.util;

import junit.framework.TestCase;

public class UtilTestCase extends TestCase {
	public void testCountCapitalChar(){
		String str = "ABC";
		assertEquals(3, Util.countCapitalChar(str));
		str = "AZ";
		assertEquals(2, Util.countCapitalChar(str));
		str = "aZ";
		assertEquals(1, Util.countCapitalChar(str));
		str = "Az";
		assertEquals(1, Util.countCapitalChar(str));
		str = "az";
		assertEquals(0, Util.countCapitalChar(str));
		str = "a z";
		assertEquals(0, Util.countCapitalChar(str));
		str = "A Z";
		assertEquals(2, Util.countCapitalChar(str));
	}
	
	public void testValidIp(){
		assertTrue(Util.validIP("1.1.1.1"));
		assertFalse(Util.validIP("1.1.1.1.1"));
		assertFalse(Util.validIP("a.b.c.d"));
		assertFalse(Util.validIP("1.2.3.d"));
		assertTrue(Util.validIP("255.255.255.255"));
		assertFalse(Util.validIP("255.255.255.256`"));
	}
}
